package cn.xshi.bpm.service.impl;
import java.util.List;
import java.util.Map;

import cn.xshi.bpm.service.LcFieldHtmlService;
import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import org.springframework.stereotype.Service;
import cn.xshi.bpm.dao.LcFieldHtmlDao;
import cn.xshi.bpm.model.LcFieldHtml;
import javax.annotation.Resource;
/**
 * @Desc 字段html类型
 * @Author 邓纯杰
 * @CreateTime 2022-04-04 18:38:14
 */
@Service
public class LcFieldHtmlServiceImpl extends BaseService implements LcFieldHtmlService {

	@Resource
	private LcFieldHtmlDao lcFieldHtmlDao;

	/**
	 * 分页
	 * @param condition
	 * @return
	 */
	public List<LcFieldHtml> getLcFieldHtmlListByCondition(Map<String,Object> condition){
		try{
			return lcFieldHtmlDao.getLcFieldHtmlListByCondition(condition);
		} catch (Exception e) {
			/**捕捉异常并回滚**/
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 查询对象
	 * @param id
	 * @return
	 */
	public LcFieldHtml getLcFieldHtmlById(String id){
		try{
			LcFieldHtml lcFieldHtml = lcFieldHtmlDao.getLcFieldHtmlById(id);
			return lcFieldHtml;
		} catch (Exception e) {
			/**捕捉异常并回滚**/
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	 * 添加
	 * @param lcFieldHtml
	 * @return
	 */
	public int addLcFieldHtml(LcFieldHtml lcFieldHtml){
		int i = 0;
		try {
			lcFieldHtml.setCreateId(getCurrentAccountId());
			lcFieldHtml.setCreateTime(getDate());
			lcFieldHtml.setId(toUUID());
			i = lcFieldHtmlDao.addLcFieldHtml(lcFieldHtml);
		} catch (Exception e) {
			i = 0;
			/**捕捉异常并回滚**/
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改
	 * @param lcFieldHtml
	 * @return
	 */
	public int updateLcFieldHtml(LcFieldHtml lcFieldHtml){
		int i = 0;
		try {
			lcFieldHtml.setUpdateId(getCurrentAccountId());
			lcFieldHtml.setUpdateTime(getDate());
			i = lcFieldHtmlDao.updateLcFieldHtml(lcFieldHtml);
		} catch (Exception e) {
			i = 0;
			/**捕捉异常并回滚**/
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 修改（根据动态条件）
	 * @param lcFieldHtml
	 * @return
	 */
	public int updateLcFieldHtmlBySelective(LcFieldHtml lcFieldHtml){
		int i = 0;
		try {
			i = lcFieldHtmlDao.updateLcFieldHtmlBySelective(lcFieldHtml);
		} catch (Exception e) {
			i = 0;
			/**捕捉异常并回滚**/
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	 * 删除
	 * @param condition
	 * @return
	 */
	public int delLcFieldHtml(Map<String,Object> condition){
		int i = 0;
		try {
			i = lcFieldHtmlDao.delLcFieldHtml(condition);
		} catch (Exception e) {
			i = 0;
			/**捕捉异常并回滚**/
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}